package com.asistencia.businness;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.asistencia.dao.interfaces.ClassroomDao;
import com.asistencia.domain.Classroom;
import com.asistencia.domain.Student;
@Service
public class ClassroomBusiness {
	@Autowired
	private ClassroomDao classDao;
	
	@Autowired
	private Classroom clas;
	
	public List<Classroom> listAll(){
		try{
			classDao.listAll();
			List<Classroom> lisAll=classDao.listAll();
			return lisAll;
		}catch(DataAccessException e){
			e.printStackTrace();
			return null;
		} catch(Exception e){
			e.printStackTrace();
			return null;
		}	
	}
	
	public List<Classroom> listByBlock(String block) {
		try{
			classDao.listByBlock(block);
			List<Classroom> lstByName=classDao.listByBlock(block);
			return lstByName;
			} catch (DataAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		} catch(Exception e){
			e.printStackTrace();
			return null;
		}
		}
	public Classroom getById(Integer idClassroom){
		try {
			clas= classDao.getById(idClassroom);
				return clas;	
			}
	
	catch (DataAccessException e){
			e.printStackTrace();
			return null;
		}}
}
